package com.face.server.communication.mina.factory;

import com.face.server.communication.mina.coder.ByteArrayDecoder;
import com.face.server.communication.mina.coder.ByteArrayEncoder;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

/**
 * @author yangzhongming
 * @desc 人脸识别出纸机--编解码器工厂
 * @date 2022/1/24
 */
public class ByteArrayCodecFactory implements ProtocolCodecFactory {
    private ByteArrayDecoder decoder;
    private ByteArrayEncoder encoder;

    public ByteArrayCodecFactory() {
        decoder = new ByteArrayDecoder();
        encoder = new ByteArrayEncoder();
    }

    @Override
    public ProtocolEncoder getEncoder(IoSession ioSession) throws Exception {
        return encoder;
    }

    @Override
    public ProtocolDecoder getDecoder(IoSession ioSession) throws Exception {
        return decoder;
    }
}
